
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<html>
<head><title>Site Administration</title>
<link rel="stylesheet" href="../default.css">
<script language="javascript" src="../chk.js"></script>
<script language="javascript" type="text/javascript">
<!--
function addNewLogin() {
	var uList = document.getElementById("uList");
	var newLogin = document.getElementById("uName").value;
	var newUser = document.createElement("option");
	
	newUser.id = "-1";
	newUser.text = newLogin;
	newUser.value = newLogin;

	if(newLogin!="") {
 		try {
			// method that works in IE;
			document.chatform.uList.add(newUser);
     		} catch(ex) {
      		// standards compliant; doesn't work in IE
			uList.appendChild(newUser);
    		}
	}
}

function removeSelectedLogin() {
	var uList = document.getElementById("uList");
	var users = uList.childNodes;

	for (i=0; i<users.length; i++){
		if(users[i].selected==true) {
			users[i].text += " (Delete)";
			users[i].value = users[i].text;
		}
	}
}

function undoRemoveLogin() {
	var uList = document.getElementById("uList");
	var users = uList.childNodes;

	for (i=0; i<users.length; i++){
		if(users[i].selected==true) {
			users[i].text = users[i].text.substring(0, users[i].text.indexOf(" "));
			users[i].value = users[i].text;
		}
	}
}

function selectAllUsers() {
	var uList = document.getElementById("uList");
	var users = uList.childNodes;

	for (i=0; i<users.length; i++){
		users[i].selected=true;
		if(users[i].id=="-1") {
			users[i].value += " (New)";
		}
	}
}

//-->
</script>
</head>

<body class="main">
<table width="590" border="0" cellpadding="0" cellspacing="0">
<tr><td valign="top">
<p class="crumbs"><a href="index.jsp">Website Administration</a> &gt; Add a Chat Room</p>
<h1>
Chat
</h1>

<h2>Add or Remove Participant Logins</h2>
<br>

<p>Before participants or a staff members (including yourself!) can participate in any of the chats, their login names <i>must</i> be added to the chat database.  This step is necessary to 1) help keep the chat rooms more secure, and 2) make the chat experience more convenient for users.</p> 

<ul>
<li><b>To add a login</b>, enter a particpant's or staff member's username in the box below, then hit &quot;Add Login&quot;.</li>
<li><b>To remove a login</b>, click on the username in the User List below, and hit &quot;Remove Login&quot;.  If you have second thoughts, click on the username again and hit &quot;Undo Delete&quot;</li>
</ul>

<form id="chatform" method="post" action="UpdateChatUsers.jsp">
<div class="subNavHead">
<b>Username: </b>
<input type="text" name="uName" id="uName" size="40" />
<input type="button" id="addLogin" value=" Add Login " onclick="addNewLogin()" />
</div>

<p>
<table border="0" cellpadding="6">
<tr>
<td valign="top"><b>User List:</b></td>
<td>
<select multiple name="uList" id="uList" size="15" style="width:225px;">

<jsp:include page="/servlet/chatManagers.getChatUsers"></jsp:include>

</select>
<br>
<input type="button" id="removeLogin" value=" Remove Login " onclick="removeSelectedLogin()"/>
<input type="button" id="undoRemove" value=" Undo Delete " onclick="undoRemoveLogin()"/>
</td>
</tr>
</table>
</p>

<p>When you are finished, hit &quot;Save Changes&quot; to save and continue.</p>
<input type="button" value=" Save Changes " onClick="selectAllUsers(); document.forms[0].submit();">
<input type="button" value=" Cancel " onClick="parent.mainFrame.location='index.jsp'">
</form>

<p>&nbsp;</p>

<hr><p align='center'>&copy; 2007 SIS<br>
Site maintained by <a href="mailto:spring@pitt.edu">MBSpring</a><br>
Phone</p>


</td>
</tr>
</table>
</body>
</html>
